﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Administration.Modules.ProductFilesControl"
    CodeBehind="ProductFiles.ascx.cs" %>
<%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="NumericTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="SimpleTextBox" Src="SimpleTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="ToolTipLabel" Src="ToolTipLabelControl.ascx" %>

<script type="text/javascript">
    function showUploadFPanels() {
        if ($('#uplf20').is(':hidden')) {
            $('#uplf20').show();
            $('#uplf21').show();
            $('#uplf22').show();
            $('#uplf23').show();
        }
        else if ($('#uplf30').is(':hidden')) {
            $('#uplf30').show();
            $('#uplf31').show();
            $('#uplf32').show();
            $('#uplf33').show();
        }
        else {
            $('#<%=btnMoreUploads.ClientID %>').attr("disabled", "disabled");
        }
    }
</script>

<asp:Panel runat="server" ID="pnlData">
    <asp:GridView ID="gvwFiles" runat="server" AutoGenerateColumns="false" DataKeyNames="ProductFileId"
        OnRowDeleting="gvwFiles_RowDeleting" OnRowDataBound="gvwFiles_RowDataBound"
        OnRowCommand="gvwFiles_RowCommand" Width="100%">
        <Columns>
            <asp:TemplateField HeaderText="Имя файла">
                <ItemTemplate>
                    <asp:HyperLink ID="hlFileName" runat="server" Target="_blank"></asp:HyperLink>
                    <asp:HiddenField ID="hfProductFileId" runat="server" Value='<%# Eval("ProductFileId") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<% $NopResources:Admin.ProductPictures.DisplayOrder %>"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtProductFileDisplayOrder"
                        Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="<% $NopResources:Admin.ProductFiles.DisplayOrder.RequiredErrorMessage %>"
                        RangeErrorMessage="<% $NopResources:Admin.ProductFiles.DisplayOrder.RangeErrorMessage %>"
                        ValidationGroup="ProductFiles" MinimumValue="-99999" MaximumValue="99999">
                    </nopCommerce:NumericTextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Описание"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left">
                <ItemTemplate>
                    <asp:TextBox ID="txtProductFileDescription" runat="server" CssClass="adminInput" 
                      Text='<%# Eval("Description") %>' ValidationGroup="ProductFiles" Width="250px"></asp:TextBox>    
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<% $NopResources:Admin.ProductPictures.Update %>"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:Button ID="btnUpdate" runat="server" CssClass="adminButton" Text="<% $NopResources:Admin.ProductPictures.Update %>"
                        ValidationGroup="ProductFiles" CommandName="UpdateProductFile" ToolTip="<% $NopResources:Admin.ProductPictures.Update %>" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<% $NopResources:Admin.ProductPictures.Delete %>"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:Button ID="btnDeleteFile" runat="server" CssClass="adminButton" Text="<% $NopResources:Admin.ProductPictures.Delete %>"
                        CausesValidation="false" CommandName="Delete" ToolTip="<% $NopResources:Admin.ProductPictures.Delete %>" 
                        OnClientClick="return confirm('Пожалуйста подтвердите удаление');"/>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <p>
        <strong>
            Добавить новый файл
        </strong>
    </p>
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblSelectFile1" Text="Выберите файл"
                    ToolTip="Выберите файл" ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:FileUpload ID="fuProductFile1" CssClass="adminInput" runat="server"
                    ToolTip="<% $NopResources:Admin.ProductPictures.FileUpload %>" />
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblDescription1" Text="Описание"
                    ToolTip="Описание"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:TextBox ID="txtDescription1" runat="server" CssClass="adminInput" ValidationGroup="UploadNewProductFile"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblProductDisplayOrder1" Text="<% $NopResources:Admin.ProductPictures.New.DisplayOrder %>"
                    ToolTip="<% $NopResources:Admin.ProductPictures.New.DisplayOrder %>"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtProductFileDisplayOrder1"
                    Value="1" RequiredErrorMessage="<% $NopResources:Admin.ProductFiles.New.DisplayOrder.RequiredErrorMessage %>"
                    RangeErrorMessage="<% $NopResources:Admin.ProductFiles.New.DisplayOrder.RangeErrorMessage %>"
                    MinimumValue="-99999" MaximumValue="99999" ValidationGroup="UploadNewProductFile">
                </nopCommerce:NumericTextBox>
            </td>
        </tr>
        
        <tr id="uplf20" style="display: none;">
            <td colspan="2">
                <br />
            </td>
        </tr>
        <tr id="uplf21" style="display: none;">
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblSelectFile2" Text="Выберите файл"
                    ToolTip="Выберите файл" ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:FileUpload ID="fuProductFile2" CssClass="adminInput" runat="server"
                    ToolTip="<% $NopResources:Admin.ProductPictures.FileUpload %>" />
            </td>
        </tr>
        <tr id="uplf22" style="display: none;">
          <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblDescription2" Text="Описание"
                    ToolTip="Описание"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:TextBox ID="txtDescription2" runat="server" CssClass="adminInput" ValidationGroup="UploadNewProductFile"></asp:TextBox>
            </td>  
        </tr>
        <tr id="uplf23" style="display: none;">
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblProductDisplayOrder2" Text="<% $NopResources:Admin.ProductPictures.New.DisplayOrder %>"
                    ToolTip="<% $NopResources:Admin.ProductPictures.New.DisplayOrder %>"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtProductFileDisplayOrder2"
                    Value="1" RequiredErrorMessage="<% $NopResources:Admin.ProductFiles.New.DisplayOrder.RequiredErrorMessage %>"
                    RangeErrorMessage="<% $NopResources:Admin.ProductFiles.New.DisplayOrder.RangeErrorMessage %>"
                    MinimumValue="-99999" MaximumValue="99999" ValidationGroup="UploadNewProductFile">
                </nopCommerce:NumericTextBox>
            </td>
        </tr>

        <tr id="uplf30" style="display: none;">
            <td colspan="2">
                <br />
            </td>
        </tr>
        <tr id="uplf31" style="display: none;">
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblSelectFile3" Text="Выберите файл"
                    ToolTip="Выберите файл" ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:FileUpload ID="fuProductFile3" CssClass="adminInput" runat="server"
                    ToolTip="<% $NopResources:Admin.ProductPictures.FileUpload %>" />
            </td>
        </tr>
        <tr id="uplf32" style="display: none;">
          <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblDescription3" Text="Описание"
                    ToolTip="Описание"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:TextBox ID="txtDescription3" runat="server" CssClass="adminInput" ValidationGroup="UploadNewProductFile"></asp:TextBox>
            </td>  
        </tr>
        <tr id="uplf33" style="display: none;">
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblProductDisplayOrder3" Text="<% $NopResources:Admin.ProductPictures.New.DisplayOrder %>"
                    ToolTip="<% $NopResources:Admin.ProductPictures.New.DisplayOrder %>"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtProductFileDisplayOrder3"
                    Value="1" RequiredErrorMessage="<% $NopResources:Admin.ProductFiles.New.DisplayOrder.RequiredErrorMessage %>"
                    RangeErrorMessage="<% $NopResources:Admin.ProductFiles.New.DisplayOrder.RangeErrorMessage %>"
                    MinimumValue="-99999" MaximumValue="99999" ValidationGroup="UploadNewProductFile">
                </nopCommerce:NumericTextBox>
            </td>
        </tr>

        <tr>
            <td colspan="2" align="left">
                <asp:Button runat="server" ID="btnMoreUploads" CssClass="adminButton" Text="+" />
                <asp:Button runat="server" ID="btnUploadProductFile" CssClass="adminButton" Text="<% $NopResources:Admin.ProductPictures.UploadButton.Text %>"
                    ValidationGroup="UploadNewProductFile" OnClick="btnUploadProductFile_Click"
                    ToolTip="Загрузить файл" />
            </td>
        </tr>
    </table>
</asp:Panel>
<asp:Panel runat="server" ID="pnlMessage">
    Необходимо сохранить товар, прежде чем загружать на сайт файлы для этого товара.
</asp:Panel>
